
/******************************************************************************\
|    Title:        	 TABLE E10: Alternative Treatment Coding: Incorporate Days |
						Covered												   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000

use congress_yearly.dta, clear
xtset stafferid year

*******************************************
** 2008-2016

xtreg lobbydirectafter switchtouncovered_treatment60 i.year if posttreat==1, fe nonest vce(cluster stafferid) 
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model1
estadd local fixed "Yes" , replace
	
xtreg lobbydirectafter switchtouncovered_treatment60 daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model2
estadd local fixed "Yes" , replace

xtreg lobbydirectafter switchtouncovered_treatment60 daysworked experience_imp experience_sq committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model3
estadd local fixed "Yes" , replace

*******************************************
** 2007-2016

xtreg lobbydirectafter switchtouncovered_treatment60 i.year if posttreat==1 | year==2007, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean)
est store model1b
estadd local fixed "Yes" , replace

xtreg lobbydirectafter switchtouncovered_treatment60 daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1 | year==2007, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model2b
estadd local fixed "Yes" , replace

xtreg lobbydirectafter switchtouncovered_treatment60 daysworked experience_imp experience_sq committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.year if posttreat==1 | year==2007, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model3b
estadd local fixed "Yes" , replace


esttab model1 model2 model3 model1b model2b model3b using "TABLED10.csv", replace ///
	b(3) se(3) star(* .05 ** .01 *** 0.001) ///
	stats(fixed ymean N N_g r2, fmt(0 3 0 0 3) labels("Staffer FE" "Mean of DV"  "Observations" "Number of staffers" "R2"))  ///
	nomtitles mgroups("2001-2007" "2001-2006", pattern(1 0 0 1 0 0)) ///
	coeflabels(switchtouncovered_treatment60 "Switch to uncovered (inc. days)" daysworked "Days worked" experience_imp "Hill experience" experience_sq "Hill experience sq." committeestaff2_everyear "Committee staff" personalstaff_everyear "Personal staff" senate_everyear "Senate staff" majority_everyear "Majority party staff" minority_everyear "Minority party staff" dcoffice_everyear "DC office staff" leaderofficestaff_everyear "Leadership office staff") ///
    label parentheses nogaps nolines noeqlines ///
    noomitted nodepvars nobaselevels indicate("Year FE = *.year") nonotes noconstant